<div class="biaotbody">
    <div style="text-align:center;padding-top:20px;">
    <table>
        <tr>
            <td>
                <input type="text" name="rate" id="rate" value="<?php echo $this->rate->value; ?>" maxlength='5' onKeyUp="clearNoNum(event,this)" onBlur="checkNum(this)" />
                <input type="button" value="保存汇率" id="send" />例:6.1
            </td>
        </tr>
    </table>
    </div>
</div>
<script type="text/javascript">
    function clearNoNum(event,obj){ 
        event = window.event||event; 
        if(event.keyCode == 37 | event.keyCode == 39){ 
            return; 
        } 
        obj.value = obj.value.replace(/[^\d.]/g,""); 
        obj.value = obj.value.replace(/^\./g,""); 
        obj.value = obj.value.replace(/\.{2,}/g,"."); 
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); 
    } 
    function checkNum(obj){ 
        obj.value = obj.value.replace(/\.$/g,""); 
    } 
    $(function(){
        $('#send').click(function(){
            var rate = $.trim($('#rate').val());
            if(!confirm('是否更新汇率')){
                return false;
            }
            $.ajax({
                type: "POST",
                url: "/admini/system/rate",
                data: {rate:rate},
                dataType: "json",
                success: function(_d, _s){
                    alert(_d.m);
                    location.reload();
                }
            });
        })
    })
</script>

